//
//  AppDelegate.m
//  FindPreciousFrameWork
//
//  Created by user on 16/4/3.
//  Copyright © 2016年 MoreMoney. All rights reserved.
//

#import "AppDelegate.h"
#import "XBFeatureViewController.h"

@interface AppDelegate ()

/** 新特性图片数组 */
@property (nonatomic,strong) NSArray *imageArray;

/** 新特性控制器 */
@property (nonatomic,strong) XBFeatureViewController *featureViewController;

@end

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    
    // 延迟启动
    [NSThread sleepForTimeInterval:2];
    
  // 新版本特性
    // 创建窗口
    self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
    
    // 设置根控制器
    [self.featureViewController loginApplication:application rootVc:^(__kindof UIViewController *viewController)
     {
         self.window.rootViewController = viewController;
         self.featureViewController = nil;
     }];
    
    // 显示窗口
    [self.window makeKeyAndVisible];
    
    return YES;
}

#pragma mark - ======== 懒加载 ========
- (XBFeatureViewController *)featureViewController
{
    if (!_featureViewController) {
        
        _featureViewController = [[XBFeatureViewController alloc]init];
        _featureViewController.images = self.imageArray;
        _featureViewController.startImageName = @"guide_start";
        _featureViewController.mainStoryBoard = @"FrameWork";
        _featureViewController.pageControlHidden = NO;
    }
    return _featureViewController;
}

// 图片需要适配手机尺寸
- (NSArray *)imageArray
{
    if (!_imageArray) {
        // 新特性图片数组
        NSMutableArray *imageArray = [NSMutableArray array];
        for (NSInteger i = 0; i < 4; i++) {
            
            // 创建图片
            UIImage *img = [UIImage imageNamed:[NSString stringWithFormat:@"start_image_%zd_4.7",i+1]];
            [imageArray addObject:img];
        }
        _imageArray = imageArray;
    }
    return _imageArray;
}
@end
